<%-- 
    Document   : userdb
    Created on : Jan 14, 2013, 8:52:53 PM
    Author     : Bittuji
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include  file="db.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
        
        String uname= request.getParameter("uname");
        String pwd = request.getParameter("password");
        String email = request.getParameter("email");
        String add = request.getParameter("address");
        int cno = Integer.parseInt(request.getParameter("contactno"));
        
        try
        {
        String sql = "INSERT INTO `user`(`user_name`, `password`, `email`, `address`, `contact`) VALUES (?,?,?,?,?)";
        
        PreparedStatement pstmt = con.prepareStatement(sql);
        
        pstmt.setString(1, uname);
        pstmt.setString(2, pwd);
        pstmt.setString(3, email);
        pstmt.setString(4, add);
        pstmt.setInt(5, cno);
        
        int result = pstmt.executeUpdate();
        
        if(result==1)
        System.out.println("data inserted");
        }
        catch(Exception e)
        {
        System.out.print(e);
        e.printStackTrace();

        }
        
        
        %>
    </body>
</html>
